<p style="color:#222; font-size:12px; font-weight:600; margin:10px;">Você está em: <a href="?pagina=home">Painel Administrativo</a> / <a href="?pagina=cliente-listar">Listagem de Clientes</a> 
    / Cadastro de Cliente</p>
<?php
include_once('facilitador.php');
conexao();
bloqueia();
?>
<link href="jquery.validate.css" rel="stylesheet" type="text/css" />
<link href="jquery.ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-1.8.0.min.js" /></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.ui.js" type="text/javascript" language="javascript"></script>
<script src="jquery.validate.engine.js" type="text/javascript" language="javascript"></script>
<script src="jquery.maskedinput.js" type="text/javascript" language="javascript"></script>
<script src="jquery.validate.engine.br.js" type="text/javascript" language="javascript"></script>
<script src="jquery.MultiFile.js" type="text/javascript" language="javascript"></script>
<script>
    jQuery(document).ready(function() {
        jQuery("#inserir").validationEngine();
        jQuery("#cpf").mask("999.999.999-99");
        jQuery("#telefone1").mask("(99)9999-9999");
        jQuery("#telefone2").mask("(99)9999-9999");
    });
        
</script>
<?php
$tab = "cliente";

$funcao = $_GET['funcao'];
if ($funcao == "") {
    $funcao = "Inserir";
}

$id = $_GET['id'];
$sql_alt = $MQ("SELECT * FROM ".$tab." WHERE id = '$id'");
while ($linha = $MFA($sql_alt)) {
    $nome = $linha['nome'];
    $cpf = $linha['cpf'];
    $email = $linha['email'];
    $telefone1 = $linha['telefone1'];
    $telefone2 = $linha['telefone2'];
    $rua = $linha['rua'];
    $num = $linha['num'];
    $comp = $linha['comp'];
    $bairro = $linha['bairro'];
    $cidade = $linha['cidade'];
    $uf = $linha['uf'];
    $cep = $linha['cep'];
    $senha = base64_decode($linha['senha']);
    $autoriza = $linha['autoriza'];
    
    
}

?>

<form name="formUpload" id="formUpload" action="?pagina=cliente-cadastrar&funcao=<?php echo $funcao; ?>&id=<?php echo $id; ?>" method="post" enctype="multipart/form-data">
    <table class="tab" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="#999"><strong>Nome:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="nome" id="nome" size="40" value="<?php echo stripslashes($nome); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>CPF:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="cpf" id="cpf" size="40" value="<?php echo stripslashes($cpf); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>E-mail:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="email" id="email" size="40" value="<?php echo stripslashes($email); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Telefone 1:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="telefone1" id="telefone1" size="40" value="<?php echo stripslashes($telefone1); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Telefone 2:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="telefone2" id="telefone2" size="40" value="<?php echo stripslashes($telefone2); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Rua:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="rua" id="rua" size="40" value="<?php echo stripslashes($rua); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Numero:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="numero" id="numero" size="40" value="<?php echo stripslashes($num); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Complemento:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="complemento" id="complemento" size="40" value="<?php echo stripslashes($comp); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Bairro:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="bairro" id="bairro" size="40" value="<?php echo stripslashes($bairro); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Cidade:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="cidade" id="cidade" size="40" value="<?php echo stripslashes($cidade); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>UF:</strong></td>
            <td bgcolor="#999">
                <select name="uf" id="uf">
                    <option <?php if($uf == "al"){ echo 'selected="selected"';} ?>  value="al">Alagoas</option>
                    <option <?php if($uf == "am"){ echo 'selected="selected"';} ?>  value="am">Amazonas</option>
                    <option <?php if($uf == "ap"){ echo 'selected="selected"';} ?>  value="ap">Amapá</option>
                    <option <?php if($uf == "ba"){ echo 'selected="selected"';} ?>  value="ba">Bahia</option>
                    <option <?php if($uf == "ce"){ echo 'selected="selected"';} ?>  value="ce">Ceará</option>
                    <option <?php if($uf == "df"){ echo 'selected="selected"';} ?>  value="df">Distrito Federal</option>
                    <option <?php if($uf == "es"){ echo 'selected="selected"';} ?>  value="es">Espírito Santo</option>
                    <option <?php if($uf == "go"){ echo 'selected="selected"';} ?>  value="go">Goiás</option>
                    <option <?php if($uf == "ma"){ echo 'selected="selected"';} ?>  value="ma">Maranhão</option>
                    <option <?php if($uf == "mg"){ echo 'selected="selected"';} ?>  value="mg">Minas Gerais</option>
                    <option <?php if($uf == "ms"){ echo 'selected="selected"';} ?>  value="ms">Mato Grosso do Sul</option>
                    <option <?php if($uf == "mt"){ echo 'selected="selected"';} ?>  value="mt">Mato Grosso</option>
                    <option <?php if($uf == "pa"){ echo 'selected="selected"';} ?>  value="pa">Pará</option>
                    <option <?php if($uf == "pb"){ echo 'selected="selected"';} ?>  value="pb">Paraíba</option>
                    <option <?php if($uf == "pe"){ echo 'selected="selected"';} ?>  value="pe">Pernambuco</option>
                    <option <?php if($uf == "pi"){ echo 'selected="selected"';} ?>  value="pi">Piauí</option>
                    <option <?php if($uf == "pr"){ echo 'selected="selected"';} ?>  value="pr">Paraná</option>
                    <option <?php if($uf == "rj"){ echo 'selected="selected"';} ?>  value="rj">Rio de Janeiro</option>
                    <option <?php if($uf == "rn"){ echo 'selected="selected"';} ?>  value="rn">Rio Grande do Norte</option>
                    <option <?php if($uf == "ro"){ echo 'selected="selected"';} ?>  value="ro">Rondônia</option>
                    <option <?php if($uf == "rr"){ echo 'selected="selected"';} ?>  value="rr">Roraima</option>
                    <option <?php if($uf == "rs"){ echo 'selected="selected"';} ?>  value="rs">Rio Grande do Sul</option>
                    <option <?php if($uf == "sc"){ echo 'selected="selected"';} ?>  value="sc">Santa Catarina</option>
                    <option <?php if($uf == "se"){ echo 'selected="selected"';} ?>  value="se">Sergipe</option>
                    <option <?php if($uf == "sp"){ echo 'selected="selected"';} ?>  value="sp">São Paulo</option>
                    <option <?php if($uf == "to"){ echo 'selected="selected"';} ?>  value="to">Tocantins</option>
                </select></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>CEP:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="cep" id="cep" size="40" value="<?php echo stripslashes($cep); ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Senha:</strong></td>
            <td align="left" bgcolor="#999">
                <input type="text" class="edi" name="senha" id="senha" size="40" value="<?php echo $senha; ?>"/></td>
        </tr>
        <tr>
            <td bgcolor="#999"><strong>Autoriza:</strong></td>
            <td bgcolor="#999">
                <select name="autoriza" id="autoriza">
                    <option <?php if($autoriza == "sim"){ echo 'selected="selected"';} ?>  value="sim">Sim</option>
                    <option <?php if($autoriza == "nao"){ echo 'selected="selected"';} ?>  value="nao">Não</option>
                </select></td>
        </tr>
        <tr>
            <td bgcolor="#999">&nbsp;</td>
            <td bgcolor="#999"><input class="bo" type="submit"  name="inserir" id="inserir" value="<?php echo $funcao; ?>"/></td>
        </tr>
    </table>
</form>

